import httpInstance from '@/utils/http'

// 封装商品一级分类接口
export const getCategoryAPI = (id) => {
  return httpInstance({
    url: '/category',
    params: {
      id
    }
  })
}

// 封装商品二级分类接口
export const getSubCategoryAPI = (id) => {
  return httpInstance({
    url: '/category/sub/filter',
    params: {
      id
    }
  })
}

// 封装二级分类列表下的商品接口
/**
 *
 * @param {*} data {
     categoryId: 1005000 ,
     page: 1,
     pageSize: 20,
     sortField: 'publishTime' | 'orderNum' | 'evaluateNum'
 * @returns
 */
export const getSubCategoryGoodsAPI = (data) => {
  return httpInstance({
    url: '/category/goods/temporary',
    method: 'POST',
    data
  })
}
